package com.study.meng.bigevent.mapper;

import com.study.meng.bigevent.entity.Article;
import com.study.meng.bigevent.entity.PageBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author 86150
* @description 针对表【article】的数据库操作Mapper
* @createDate 2025-06-17 11:28:16
* @Entity com.study.meng.bigevent.entity.Article
*/
@Mapper
public interface ArticleMapper {
    @Insert("insert into article (title, content, cover_img,category_id,state, create_time, update_time, create_user) " +
            "values (#{title}, #{content}, #{coverImg}, #{categoryId},#{state},#{createTime}, #{updateTime}, #{createUser})")
    boolean add(Article article);

    List<Article> list(@Param("categoryId") Integer categoryId,
                       @Param("state") String state,
                       @Param("createUser") Integer createUser);
    @Select("select count(*) from article where category_id = #{id}")
    Integer countByCategoryId(Integer id);
}




